package top.hisoft.pattern.creational.simplefactory.farm;

import top.hisoft.pattern.creational.simplefactory.farm.exception.BadFruitException;

/**
 * 客户
 *
 * @author sky
 */
public class Client {

    public static void main(String[] args) {

        try {
            Fruit apple = FruitFactory.createFruit("apple");
            apple.grow();

            Fruit grape = FruitFactory.createFruit("grape");
            grape.harvest();

            Fruit strawberry = FruitFactory.createFruit("strawberry");
            strawberry.plant();

            Fruit pear = FruitFactory.createFruit("pear");
            pear.plant();
        } catch (BadFruitException e) {
            throw new RuntimeException(e);
        }
    }
}
